# rtsp_connect_openvino_nms.spec
# -*- mode: python ; coding: utf-8 -*-

block_cipher = None

a = Analysis(
    ['rtsp_connect_openvino_nms_async.py'],     # 主脚本
    pathex=[],                            # 可选：额外 Python 路径
    binaries=[
    (
        r'E:\ProgramFiles\Anaconda3\envs\pyinstaller\Lib\site-packages\openvino\libs\openvino_ir_frontend.dll',
        'openvino/libs'
    ),
    (
        r'E:\ProgramFiles\Anaconda3\envs\pyinstaller\Lib\site-packages\openvino\libs\openvino_intel_cpu_plugin.dll',
        'openvino/libs'
    )
],
    datas=[],
    hiddenimports=[
        # --- 核心依赖 ---
        'openvino',
        'openvino.runtime',
        'openvino.preprocess',

        # --- NumPy 相关（关键！防止 array 相关报错）---
        'numpy',
        'numpy.core._dtype_ctypes',
        'numpy.core._multiarray_tests',
        'numpy.core._multiarray_umath',
        'numpy.lib.format',
        'numpy.random.common',
        'numpy.random.bounded_integers',
        'numpy.random.entropy',

        # --- 多进程 & 多线程 ---
        'multiprocessing',
        'multiprocessing.shared_memory',
        'multiprocessing.synchronize',
        'multiprocessing.heap',
        'multiprocessing.connection',

        # --- OpenCV ---
        'cv2',
        'cv2.data',  # 包含级联分类器等资源（如果用到）

        # --- PyQt5 ---
        'PyQt5',
        'PyQt5.QtCore',
        'PyQt5.QtGui',
        'PyQt5.QtWidgets',
        'PyQt5.sip',  # 必须包含

        # --- 日志 ---
        'logging',
        'logging.handlers',

        # --- 其他 ---
        'pathlib',
        'json',
        're',
        'os',
        'sys',
        'time',
        'datetime',
    ],
    hookspath=[],
    hooksconfig={},
    runtime_hooks=[],
    excludes=[
        # 可选：排除不需要的包以减小体积
        # 'tkinter', 'unittest', 'email', 'http', 'xml', 'pydoc'
    ],
    noarchive=False,
    optimize=0,
)

pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)

exe = EXE(
    pyz,
    a.scripts,
    a.binaries,
    a.datas,
    [],
    name='rtsp_connect_openvino_nms',
    debug=False,
    bootloader_ignore_signals=False,
    strip=False,
    upx=True,
    upx_exclude=[
        # 可选：某些 DLL 不兼容 UPX（如 cv2 或 openvino 的某些 dll）
        # 'opencv_core*.dll',
    ],
    runtime_tmpdir=None,
    console=False,                        # False: 不显示终端（GUI应用）；True: 调试时打开看日志
    disable_windowed_traceback=False,
    argv_emulation=False,
    target_arch=None,
    codesign_identity=None,
    entitlements_file=None,
    # icon='app.ico',                      # 可选：替换为你的图标路径
)